<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../myCommon.js"></script>
    <style>
        #boll{
            width: 100px;
            height: 100px;
            background-color: red;
            border-radius:50%;
            margin-left: 0px;
        }
    </style>
</head>
<body>
<div id="boll"></div>
<div id="boll2"></div>
<input type="button" value="点我" onclick="domove()">

<script>
    var timer;//undefined
function domove(){


    clearInterval(timer);//undefined
    var bollObj = $('boll');
    function move() {
        console.log("aa");
        var nowMarginLeft = getCssObjAttr(bollObj,'marginLeft');
        if (nowMarginLeft>=500){
            clearInterval(timer);
        } else {
            bollObj.style.marginLeft = nowMarginLeft + 1+'px';
        }

    }
    timer = setInterval(move,10);
}


//    console.log(bollObj);
</script>
</body>
</html>